package net.bwie.dy.realtime.service.dyraeltimeservice.mapper;



import net.bwie.dy.realtime.service.dyraeltimeservice.bean.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName：TikTokLiveStreamMapper
 * @Author: Vvn
 * @Date: 2025/5/28 10:45
 * @Description: 必须描述类做什么事情, 实现什么功能
 */

@Mapper
public interface TikTokLiveStreamMapper {


    @Select("select\n" +
            "       roomId,\n" +
            "       sum(userCount) as userCount\n" +
            "from real_time_tiktok_report.tiktok_user_count\n" +
            "where toDate(windowStartTime) = #{date}\n" +
            "group by roomId")
    List<OnlineUserCountResult> getOnlineUserCount(String date);

    @Select("select\n" +
            "    roomId,\n" +
            "    sum(giftMoney) as giftMoney \n" +
            "from real_time_tiktok_report.tiktok_gift_money \n" +
            "where toDate(windowStartTime) = #{date} \n" +
            "group by roomId")
    List<GiftIncomeResult> getGiftIncome(String date);

    @Select("select\n" +
            "    roomId,\n" +
            "    sum(interactionCount) as interactionCount,\n" +
            "    sum(shareCount) as shareCount,\n" +
            "    sum(likeCount) as likeCount,\n" +
            "    sum(messageCount) as messageCount\n" +
            "from real_time_tiktok_report.tiktok_interaction\n" +
            "where toDate(windowStartTime) = #{date}\n" +
            "group by roomId")
    List<MessagePopularityResult> getMessagePopularity(String date);

    @Select("select\n" +
            "    Userid,\n" +
            "    sum(sendMoney) as interactionCount\n" +
            "from real_time_tiktok_report.tiktok_alert_gift\n" +
            "where toDate(windowStartTime) = #{date}\n" +
            "group by Userid")
    List<AlertGiftResult> getAlertGift(String date);

    @Select("select\n" +
            "    Userid,\n" +
            "    sum(messageCount) as messageCount\n" +
            "from real_time_tiktok_report.tiktok_alert_message\n" +
            "where toDate(windowStartTime) = #{date}\n" +
            "group by Userid")
    List<MessageCheckResult> getMessageCheck(String date);
}
